package com.niuxiaofa.newlaw.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.niuxiaofa.newlaw.R;
import com.niuxiaofa.newlaw.Tools.Constant;
import com.niuxiaofa.newlaw.Tools.GlideUtils;
import com.niuxiaofa.newlaw.Tools.UIUtils;
import com.to.aboomy.banner.HolderCreator;

import java.util.Map;


/**
 * @ClassName ImageHolderCreator
 * @Description TODO
 * @Author Gxjkz
 * @Date 2020/8/24 15:40
 * @Version 1.0
 */
//举个栗子
public class RoadGrowthHolderCreator implements HolderCreator {


    int[] bg = new int[]{R.mipmap.banner1, R.mipmap.banner2, R.mipmap.banner3,R.mipmap.banner4,R.mipmap.banner5};

    int[] start = new int[]{R.mipmap.start1, R.mipmap.start2, R.mipmap.start3,R.mipmap.start4,R.mipmap.start5};




    @Override
    public View createView(Context context, int index, Object o) {

        Map map = (Map) o;




        View view = LayoutInflater.from(context).inflate(R.layout.banner_item_road_growth, null);
        ImageView unlock=view.findViewById(R.id.unlock);




        RelativeLayout relativelayout_bg = (RelativeLayout) view.findViewById(R.id.relativelayout);
        relativelayout_bg.setBackgroundResource(bg[index]);

        ImageView user_img = view.findViewById(R.id.user_img);
        GlideUtils.loadUserImg(UIUtils.getContext(), Constant.userInfoBean.getHeader(),user_img);

        ImageView start_view = view.findViewById(R.id.start);
        start_view.setImageBitmap(UIUtils.getBitmap(start[index]));

        TextView user_name=view.findViewById(R.id.user_name);
        user_name.setText(Constant.userInfoBean.getUserName());

        return view;
    }


}

